<%@ page contentType="text/html; charset=UTF-8"%>
<%@ include file="../../common.jsp"%>

<%@page import="framework.core.Conditions"%>
<%@page import="framework.core.DBConnection"%>
<%@page import="framework.core.ObjectList"%>
<%@page import="system.base.ProductTypeManager"%>
<%@page import="system.data.ProductTypeManagerBase" %>
<html>
<head>
<title>产品增加</title>
<META http-equiv=Content-Type content="text/html; charset=UTF-8">
<LINK href="<%=root%>/css/caigouxitong.css" type=text/css rel=stylesheet>
<SCRIPT language="JavaScript" src="<%=root%>/js/calendar.js"></SCRIPT>
<SCRIPT language="JavaScript" src="<%=root%>/js/common.js"></SCRIPT>
<SCRIPT language="JavaScript" src="<%=root%>/js/string.js"></SCRIPT>
<%
    String manufactureid = (String)request.getAttribute("manufactureid");
    ArrayList tManuf1 = (ArrayList)request.getAttribute("manufacture1");
    HashMap tMap1 = (HashMap)request.getAttribute("manufacturetyp2");
    HashMap tMap2 = (HashMap)request.getAttribute("manufacturetyp3");
    ArrayList tList1 = new ArrayList();
    ResultProcess arr=(ResultProcess)session.getAttribute("manufactureExcel");
    String isPlanPrice = (String)request.getAttribute("isPlanprice");
    Object modify = session.getAttribute("modify");
    System.out.println(modify);
    if(modify!=null){
        session.removeAttribute("modify"); 
    }
%>
<script language="JavaScript">
    var counter;
    function change1(optval){
  var val = optval;
  if(val=='0'){
    var listbox = document.getElementById("manuftype2");
    listbox.length = 0;
    var option = new Option();
    option.text = "-----二级-----";
    option.value = "0";
    listbox.options[listbox.length] = option;
    change2(optval);
  }else{
      var counter="0";
    <%if(tMap1 !=null){
      Collection tCollection = tMap1.keySet();
      Iterator tIterator = tCollection.iterator();
      while(tIterator.hasNext()){
        String tKey = (String)tIterator.next();
        tList1 = (ArrayList)tMap1.get(tKey);%>
        if(val == '<%=tKey%>'){
          counter = "1";
          var listbox = document.getElementById("manuftype2");
          listbox.length = 0;
          var option = new Option();
          option.value = "0";
          option.text = "-----二级-----";
          listbox.options[listbox.length] = option;
          <%
                for(int n=0;n<tList1.size();n++){
                    GSManufactureCategoryBean tGSManufactureBean = (GSManufactureCategoryBean)tList1.get(n);
                    String categoryId = tGSManufactureBean.getGs_manufacture_category_id();
                    String categoryName = tGSManufactureBean.getGs_manufacture_category_name();%>
                    var temp1 = '<%=categoryId%>';
                    var temp2 = '<%=categoryName%>';
                    var option = new Option();
                    option.value = temp1;
                    option.text = temp2;
                    listbox.options[listbox.length] = option;
           <%
                }
           %>
            change2('0');           
         }
         
    <%
        }
    %>
        if(counter == '0'){
          var listbox = document.getElementById("manuftype2");
          listbox.length = 0;
          var option = new Option();
          option.value = "0";
          option.text = "-----二级-----";
          listbox.options[listbox.length] = option;  
          change2('0');     
        }
    <%  
    }
    %>
   }
}
    function change2(optval){
      var val = optval;
      if(val=='0'){
        var listbox = document.getElementById("manuftype3");
        listbox.length = 0;
        var option = new Option();
        option.text = "-----三级-----";
        option.value = "0";
        listbox.options[listbox.length] = option;

      }else{
        var counter = "0";
        <%if(tMap2 !=null){
          Collection tCollection = tMap2.keySet();
          Iterator tIterator = tCollection.iterator();
          while(tIterator.hasNext()){
            String tKey = (String)tIterator.next();
            tList1 = (ArrayList)tMap2.get(tKey);%>
            if(val == '<%=tKey%>'){
              counter = "1";
              var listbox = document.getElementById("manuftype3");
              listbox.length = 0;
              var option = new Option();
              option.text = "-----三级-----";
              option.value = "0";
              listbox.options[listbox.length] = option;
              <%for(int n=0;n<tList1.size();n++){
                GSManufactureCategoryBean tGSManufactureBean = (GSManufactureCategoryBean)tList1.get(n);
                String categoryId = tGSManufactureBean.getGs_manufacture_category_id();
                String categoryName = tGSManufactureBean.getGs_manufacture_category_name();%>
                var temp1 = '<%=categoryId%>';
                var temp2 = '<%=categoryName%>';
                var option = new Option();
                option.value = temp1;
                option.text = temp2;
                listbox.options[listbox.length] = option;
                <%}%>
              }
          <%
          }
          %>
          if(counter == '0'){
                var listbox = document.getElementById("manuftype3");
                listbox.length = 0;
                var option = new Option();
                option.text = "-----三级-----";
                option.value = "0";
                listbox.options[listbox.length] = option;          
          }
          <%
            }%>
          }
        }
        function doProductType(){
        	 if(!document.all.productBid.options[0].selected&&document.all.productType.value!=1){
        	    alert("招标分类只有1类区域产品才能使用，自动修正产品使用分类选项为1类区域");
                document.all.productType.value = 1;
            }
        }
        
        function checkValue(){
          	var patm = /^[^'"<>&]*$/;
        	if(!patm.test(document.all.concentricityid.value)||
        	   !patm.test(document.all.manufacturename.value)||
        	   !patm.test(document.all.quantunit.value)||
        	   !patm.test(document.all.manufacturetype.value)||
        	   !patm.test(document.all.manfuacturespec.value)||
        	   !patm.test(document.all.qualityassureperiod.value)||
        	   !patm.test(document.all.manufacturername.value)||
        	   !patm.test(document.all.makearea.value)||
        	   !patm.test(document.all.manufacturebrand.value)){
        		alert("输入信息不允许有',\",<,>,&等特殊字符");
        		return false;
        	}
        	var perad = /^\d+$/;
        	if(!perad.test(document.all.qualityassureperiod.value)&&document.all.qualityassureperiod.value!=""){
        		alert("质保期请输入0或者正整数，默认单位为天!");
        		return false;
        	}
        	if(!perad.test(document.all.kmqualityassureperiod.value)&&document.all.kmqualityassureperiod.value!=""){
        		alert("公里质保期请输入0或者正整数，默认单位为公里!");
        		return false;
        	}
        	
            if(document.all.concentricityid.value == null || Trim(document.all.concentricityid.value) == ""){
                alert("请输入产品集中编码");
                return false;
            }
            if(Trim(document.all.concentricityid.value).length!=<%=GSBaseConstants.PRODUCT_CONCENTRICITY%>&&<%=GSBaseConstants.PRODUCT_IS_CONCENTRICITY%>==0){
                if(Trim(document.all.concentricityid.value).length==<%=GSBaseConstants.PRODUCT_CONCENTRICITY2%>&&Trim(document.all.concentricityid.value).substr(Trim(document.all.concentricityid.value).length-1,1)=="0"){	
            	}else{
                	alert("请输入<%=GSBaseConstants.PRODUCT_CONCENTRICITY%>位产品集中编码或<%=GSBaseConstants.PRODUCT_CONCENTRICITY2%>位末尾为0的产品集中编码");
                	return false;
            	}
            }
            if(document.getElementById("sign").value == "1"){
                alert("集中编码不允许重复！");
                return false;
            }
            if(document.all.providerid.value == null || document.all.providerid.value == ""){
                alert("请选择或输入供应商");
                return false;
            }
            if(document.getElementById("isbuy").value == "0"){
            	var r =confirm("产品为不可采购的话，使用分类和招标分类无意义。是否继续！");
                if(!r){
                	return false;
                }
            }
            if(document.all.providerid.value != null || document.all.providerid.value != ""){
                var op=document.getElementById("oldpid").value;
                var pid=Trim(document.all.providerid.value);
                if(op!=null&&op!=""){
                    var ob=op.split("%");
                    for(var i=0;i<ob.length;i++){
                        if(pid==ob[i]){
                            alert("相同供应商不能供应同一集中编码产品");
                            return false;
                        }
                    }
                }
            }
            if(document.all.manufacturename.value == null || Trim(document.all.manufacturename.value) == ""){
                alert("请输入产品名称");
                return false;
            }
            if(document.all.manuftype1.options[0].selected && document.all.manuftype2.options[0].selected && document.all.manuftype3.options[0].selected){
                alert("请输入产品种类");
                return false;
            }
            if(document.all.quantunit.value == null || Trim(document.all.quantunit.value) == ""){
                alert("请输入产品数量单位");
                return false;
            }
            if(document.all.unitprice.value == null || Trim(document.all.unitprice.value) == ""||parseFloat(document.all.unitprice.value)<=0||isNaN(document.all.unitprice.value)){
                alert("请输入产品单价");
                return false;
            }
            if(document.all.remark.value.length>2000){
                alert("备注长度不能超过2000字符");
                return false;
            }
			if(document.all.productType.options[0].selected){
                alert("请输入产品使用分类");
                return false;
            }

            
            return true;
        }
        function process(){
            getprovalue();
            if(checkValue()){
                form1.action = "<%= response.encodeURL(request.getContextPath() + "/A400314.do") %>";
                form1.submit();
            }
        }
        function selectprovider(){
            var url ="<%=response.encodeURL(request.getContextPath() +"/A401103.do")%>";
            var returnv = window.open(url,null," edge: sunken ,center: Yes, help: No, resizable: Yes, status: No,height=580px, scrollbars=yes");
        }
        function getprovalue(){
            var str="";
            var pr1=document.all.pro1.value;
            var pr2=document.all.machinetype.value;
            var pr3=document.all.pro3.value;
            var pr4=document.all.pro4.value;
            var pr5=document.all.pro5.value;
            var pr6=document.all.pro6.value;
            if(pr1!=""){
                str+=document.getElementById("p1").innerText+"："+pr1+"；";
            }
            if(pr2!=""){
                str+=document.getElementById("p2").innerText+"："+pr2+"；";
            }
            if(pr3!=""){
                str+=document.getElementById("p3").innerText+"："+pr3+"；";
            }
            if(pr4!=""){
                str+=document.getElementById("p4").innerText+"："+pr4+"；";
            }
            if(pr5!=""){
                str+=document.getElementById("p5").innerText+"："+pr5+"；";
            }
            if(pr6!=""){
                str+=document.getElementById("p6").innerText+"："+pr6+"；";
            }
            document.all.property.value=str;
        }
        function pricef(obj){
            if(parseFloat(obj.value)<=0||isNaN(obj.value)){
                obj.value="0.0";
            }
        }
        function doUploadProductBaseFile(actionObj) 
        {
            if(actionObj.parentElement.children(0).value == "") 
            {
                alert("请选择需要导入的文件。");
                return false;
            }
    
            document.form1.action="<%=response.encodeURL(root+"/A400311.do")%>";
            form1.submit();
        }
         function checkFile(obj){
          var oExten = obj.value.replace(/^.*\.([^\.]*)$/, '$1').toLowerCase();
          if(oExten != 'xls'&&oExten != 'XLS'){
             obj.outerHTML = obj.outerHTML;
             alert("请确认导入文件为Excel文件");
          }
        }
</script>
</head>
<body BGCOLOR="#f2f2f2" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<br>
<table width="95%" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td height="20"> 
      <table width="100%" border="0" cellspacing="0" cellpadding="1">
        <tr height="20">
          <td height="20" width="1" class="mtxt_black">&nbsp;</td>
          <td height="30" width="758" class="mtxt_black">产品信息录入</td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td class="bg_line" height="2"></td>
  </tr>
</table>
<br>

<form name="form1" method="post" enctype="multipart/form-data">
<input type='hidden' name='submittype' value=''>
<table width="95%" border="0" cellspacing="0" cellpadding="0" align="center">
    <tr> 
        <td> 
        <table class=bg_table id=tableId    cellspacing=1 cellpadding=0 style="padding-left:5;padding-right:5" width=100% align=center border=0>
                <tr class="bg_column" height=25> 
                        <td align="left">批量导入产品(Excel文件路径)：                      
                          <input type='file'  class="kuang"  id='excelfile' size='50' name='excelfile' onchange="checkFile(this);">
                          <input type='button' class="kuang" id='importExcel'  name='importExcel' value='导入..' onclick="doUploadProductBaseFile(this);return false;">
                 <!--        <%if(arr!=null&&arr.getRecordsSize()>0) {%>
                            <input type='button' class="kuang" name='manufactureview' value='查看已导入产品' onclick="viewmanufacture();">
                        <% }else{%>
                            <input type='button' class="kuang" name='manufacturedown' value='下载产品导入模板' onclick="downmanufacture();">
                        <% }%> 
                   -->      
                       <input type='button' class="kuang"
                    name='manufacturedown' value='下载产品导入模板'
                    onclick="downmanufacture();">
                        
                        </td>
                </tr>
            </table>
            <br>
            <table class=bg_table id=tableId    cellspacing=1 cellpadding=0 style="padding-left:5;padding-right:5" width=100% align=center border=0>
                <tr height="25">
                <TD class="bg_column" align=center>产品种类</TD>
                    <TD class="bg_row_odd" colspan="3">
                        <select id="manuftype1" name="manuftype1" onChange="change1(this.value)">   
                        <option value="0">-----一级-----</option>             
                        <%
                            String tManufType1 = request.getParameter("manuftype1");
                            if(tManuf1 != null && tManuf1.size() > 0 ){
                                for(int i=0; i<tManuf1.size(); i++){
                                    GSManufactureCategoryBean tGSManufactureBean = (GSManufactureCategoryBean)tManuf1.get(i);
                                    if(tManufType1!=null && tManufType1.equals(tGSManufactureBean.getGs_manufacture_category_id())){
                        %>
                                <option value="<%=tGSManufactureBean.getGs_manufacture_category_id()%>" selected>
                                <%=tGSManufactureBean.getGs_manufacture_category_name()%></option>
                        <%}else{%>
                                <option value="<%=tGSManufactureBean.getGs_manufacture_category_id()%>">
                                <%=tGSManufactureBean.getGs_manufacture_category_name()%></option>
                        <%          }   
                                }
                            }
                        %>
                        </select>
                        <select id="manuftype2" name="manuftype2" onChange="change2(this.value)">   
                        <option value="0">-----二级-----</option>             
                        <%
                            String tManufType2 = request.getParameter("manuftype2");
                            if(tManufType1 != null && !tManufType1.equals("0")){
                                ArrayList temp = (ArrayList)tMap1.get(tManufType1);
                                if(temp!=null){
                                for(int i=0; i<temp.size(); i++){
                                    GSManufactureCategoryBean tGSManuf2 = (GSManufactureCategoryBean)temp.get(i);
                                    if(tManufType2!=null && tManufType2.equals(tGSManuf2.getGs_manufacture_category_id())){
                        %>
                                <option value="<%=tManufType2%>" selected><%=tGSManuf2.getGs_manufacture_category_name()%></option>
                        <%}else{%>
                                <option value="<%=tGSManuf2.getGs_manufacture_category_id()%>"><%=tGSManuf2.getGs_manufacture_category_name()%></option>
                                
                        <%          }   
                                }
                               }
                            }
                        %>

                        </select>
                        <select name="manuftype3" id="manuftype3">  
                        <option value="0">-----三级-----</option>             
                        <%
                            String tManufType3 = request.getParameter("manuftype3");
                            if(tManufType2 != null && !tManufType2.equals("0") ){
                                ArrayList temp = (ArrayList)tMap2.get(tManufType2);
                                if(temp!=null){
                                for(int i=0; i<temp.size(); i++){
                                    GSManufactureCategoryBean tGSManuf3 = (GSManufactureCategoryBean)temp.get(i);
                                    if(tManufType3!=null && tManufType3.equals(tGSManuf3.getGs_manufacture_category_id())){
                        %>
                                <option value="<%=tGSManuf3.getGs_manufacture_category_id()%>" selected><%=tGSManuf3.getGs_manufacture_category_name()%></option>
                        <%}else{%>
                                <option value="<%=tGSManuf3.getGs_manufacture_category_id()%>"><%=tGSManuf3.getGs_manufacture_category_name()%></option>
                                
                        <%          }   
                                }
                              }
                            }
                        %>

                        </select>&nbsp; <font color=red>*</font>
                    </TD>
                </tr>
                <TR height=25>
                    <TD class="bg_column" align=center>产品编号</TD>
                    <TD align=left class="bg_row_odd"><font color="#33cc00">系统自动生成</font>
                    <input type="hidden" name="manufacturecode" value="<%=manufactureid%>" readonly="readonly"></TD>                    
                    <TD class="bg_column" align=center>集中编码</TD>
                    <TD align=left class="bg_row_odd"><input type="text" name="concentricityid" style="ime-mode:disabled"  onblur="selectyes(this,'1');">&nbsp; <font color=red id="conidyes">*</font>
                    <input type="hidden" id="sign" value="0">
                    </TD>
                </TR>
                <TR height=25>
                    <TD class="bg_column" align=center>产品名称</TD>
                    <TD align=left class="bg_row_odd"><input type="text" name="manufacturename">&nbsp; <font color=red>*</font></TD>
                    <TD class="bg_column" align=center>供应商</TD>
                    <TD align=left class="bg_row_odd">
                    <input type="text" id='provider_name' name="gs_provider_name" onblur="selectyes(this,'2');">&nbsp; <font color=red>*</font>
                    <input type="hidden" id='provider_id' name="providerid" value=""><input class="kuang" type='button' value='选择供应商' onclick='selectprovider();'><input type="hidden" id='oldpid' name="oldpid" value="<%=request.getParameter("oldpid")==null?"":request.getParameter("oldpid") %>"></TD>
                </TR>
                <TR height=25>
                <TD class="bg_column" align=center>产品单价</TD>
                    <TD align=left class="bg_row_odd"><input type="text" name="unitprice" onblur="pricef(this);">&nbsp;元&nbsp; <font color=red>*</font></TD>                 
                    <TD class="bg_column" align=center>数量单位</TD>
                    <TD align=left class="bg_row_odd"><input type="text" name="quantunit">&nbsp; <font color=red>*</font></TD>               
                </TR>
                
                        <%
                            if(isPlanPrice.equals("1")){
                        %>
                        <TR height=25>
                <TD class="bg_column" align=center>计划价</TD>
                    <TD align=left class="bg_row_odd"><input type="text" name="planprice" onblur="pricef(this);">&nbsp;元&nbsp; <font color=red>*</font></TD>                 
                    <TD class="bg_column" align=center></TD>
                    <TD align=left class="bg_row_odd"></TD>               
                </TR>
                        <%}%>
                <TR height=25>
                    <TD class="bg_column" align=center>型号</TD>
                    <TD align=left class="bg_row_odd"><input type="text" name="manufacturetype"></TD>                    
                    <TD class="bg_column" align=center>规格</TD>
                    <TD align=left class="bg_row_odd"><input type="text" name="manfuacturespec"></TD>
                </TR>
                <TR height=25>
                    <TD class="bg_column" align=center>质保期</TD>
                    <TD align=left class="bg_row_odd"><input type="text" name="qualityassureperiod"><font color="red">单位为天</font></TD>                    
                    <TD class="bg_column" align=center>生产厂商</TD>
                    <TD align=left class="bg_row_odd"><input type="text" name="manufacturername"></TD>                  
                </TR>
                <TR height=25>
                    <TD class="bg_column" align=center>产地</TD>
                    <TD align=left class="bg_row_odd"><input type="text" name="makearea"></TD>                  
                    <TD class="bg_column" align=center>产品品牌</TD>
                    <TD align=left class="bg_row_odd"><input type="text" name="manufacturebrand"></TD>                      
                </TR>
                <TR height=25>
                    <TD class="bg_column" align=center>图件号</TD>
                    <TD align=left class="bg_row_odd"><input type="text" name="drawingpiececode"></TD>
                    <TD class="bg_column" align=center>是否采购</TD>
                    <TD align=left class="bg_row_odd">
                    <select name="isbuy" id="isbuy">
                    <option value="1" selected>-是-</option>
                    <option value="0">-否-</option>
                    </select>&nbsp; <font color="red">设置为否的产品在申购时无法查询到</font>
                    </TD>
                </TR>
                <TR height=25>
                    <TD class="bg_column" align=center>结算模式</TD>
                    <TD align=left class="bg_row_odd">
                    <select name="balancemode">
                        <%
                            if(isPlanPrice.equals("1")){
                        %>
                        <option value="<%=GSBaseConstants.BALANCE_MODE2 %>"><%=DefineDic.getBalanceMode(GSBaseConstants.BALANCE_MODE2) %></option>
                        <%}else{%>
                        <option value="<%=GSBaseConstants.BALANCE_MODE1 %>" selected="selected"><%=DefineDic.getBalanceMode(GSBaseConstants.BALANCE_MODE1) %></option>
                        <option value="<%=GSBaseConstants.BALANCE_MODE2 %>"><%=DefineDic.getBalanceMode(GSBaseConstants.BALANCE_MODE2) %></option>
                        <%}%>
                    </TD>
                    <TD class="bg_column" align=center>公里质保期</TD>
                    <TD align=left class="bg_row_odd">
                    <input type="text" name="kmqualityassureperiod"><font color="red">单位为公里</font>
                    </TD>
                </TR>
                <TR height=25>
                    <TD class="bg_column" align=center>产品使用分类</TD>
                    <TD align=left class="bg_row_odd">
                    	<select name="productType">
							<%
								GSProductTypeManagerDao productTypeManagerDao= new GSProductTypeManagerDao();
                    			Conditions managerConditions = new Conditions();
                    			managerConditions.add(" upper_type = "+GSBaseConstants.PRODUCT_TYPE_MANAGER_USE);
                    			managerConditions.add(" status='1'");
                  		        DBConnection con = null;
                    			ObjectList productTypeManagerTypeList = ObjectList.getList();
                    			try{
                    				con = DBConnection.open();
                    				productTypeManagerTypeList = ProductTypeManager.fetch().search(con,managerConditions);
                    			}finally{
                    				if(con!=null){
                    					con.close();
                    				}
                    			}	 
							 %>
							 <option value="">---顶级---</option>
							<%for(int i=0;i<productTypeManagerTypeList.size();i++){
									ProductTypeManager productTypeManager = (ProductTypeManager)productTypeManagerTypeList.get(i);
								 %>
										<option value="<%=productTypeManager.getProductType() %>" ><%=productTypeManager.getTypeName() %></option>
								<%
									}
								 %>
                        </select>
                        <font color=red>*</font>
                    </TD>
                    <TD class="bg_column" align=center>产品招标分类</TD>
                    <TD align=left class="bg_row_odd">
                    <select name="productBid" >
							<%
                    			Conditions bidConditions = new Conditions();
                    			bidConditions.add(" upper_type = "+GSBaseConstants.PRODUCT_TYPE_MANAGER_BID);
                    			bidConditions.add(" status='1'");
                    			ObjectList productTypeManagerBidList = ObjectList.getList();
                    			try{
                    				con = DBConnection.open();
                    				productTypeManagerBidList = ProductTypeManager.fetch().search(con,bidConditions);
                    			}finally{
                    				if(con!=null){
                    					con.close();
                    				}
                    			}	 
							 %>
							  <option value="">---顶级---</option>
							<%for(int i=0;i<productTypeManagerBidList.size();i++){
									ProductTypeManager productTypeManager = (ProductTypeManager)productTypeManagerBidList.get(i);
								 %>
										<option value="<%=productTypeManager.getProductType() %>" ><%=productTypeManager.getTypeName() %></option>
								<%
									}
								 %>
                        </select>
                    </TD>
                </TR>
                 <TR height=25>
                    <TD class="bg_column" align=center>是否到单车</TD>
                    <TD align=left class="bg_row_odd" colspan="3">
                    <select name="balancecustomercode">
                    <option value="1" selected>-否-</option>
                    <option value="0">-是-</option>
                    </select>
                    </TD>
                </TR>
                
                <TR height=25>
                    <TD class="bg_column" align=center>产品附加属性</TD>
                    <TD align=left class="bg_row_odd" colspan="3">
                    <table border="0" cellpadding="0" cellspacing="0" width="500" height="70">
                    <tr height="20">
                    <td id="p1" width="60">适用车型</td>
                    <td><input type="text" size="30" name="pro1"></td>
                    <td id="p2" width="60" align="center">适用机型</td>
                    <td><input type="text" size="30" name="machinetype"></td>
                    </tr>
                    <tr  height="20">
                    <td id="p3" width="60">适用底盘</td>
                    <td><input type="text" size="30" name="pro3"></td>
                    <td id="p4" width="60" align="center">级别特征</td>
                    <td><input type="text" size="30" name="pro4"></td>
                    </tr>
                    <tr height="20">
                    <td id="p5" width="60">材质</td>
                    <td><input type="text" size="30" name="pro5"></td>
                    <td id="p6" width="60" align="center">其他属性</td>
                    <td><input type="text" size="30" name="pro6"></td>
                    </tr>
                    </table>
                    <input type="hidden" name="property"></TD>                                     
                </TR>
                <TR height=25>
                    <TD class="bg_column" align=center>备注</TD>
                    <TD align=left class="bg_row_odd" colspan="3">
                    <textarea rows="8" cols="80" name="remark"></textarea>
                    </TD>                 
                </TR>
            </table>
        </td>
    </tr>
</table>
<br>&nbsp;&nbsp;&nbsp; <font color="red">备注长度不能超过2000字符</font>
</form>
    <p align="center">  
        <input type="button" width="58" height="24" class="kuang" onclick="process();" value="确定"/>&nbsp;
        <input type="button"  width="58" height="24" class="kuang" onclick="javascript:window.close();" value="关闭"/>
    </p>
    <script type="text/javascript">
        function find(){
            var cid=document.form1.concentricityid.value;
            var rootURL = "<%=response.encodeURL(request.getContextPath()+"/A400318.do")%>?cid="+cid;
            var returnval=window.showModalDialog(encodeURI(rootURL),"","dialogWidth=950px,dialogHeight=600px");
            if(returnval!=null){
                var cat=returnval[0].split("%");
                for(var i=0;i<cat.length;i++){
                    var a=i+1;
                    var s="manuftype"+a;
                    var sn=document.getElementById(s);
                    if(i==1){
                        change1(cat[0]);
                    }
                    if(i==2){
                        change2(cat[1]);
                    }
                    sn.value=cat[i];
                }
                var name=returnval[1];
                document.form1.manufacturename.value=name;
                document.form1.unitprice.value=returnval[4];
                document.form1.quantunit.value=returnval[5];
                document.form1.manufacturetype.value=returnval[6];
                document.form1.manfuacturespec.value=returnval[7];
                document.form1.qualityassureperiod.value=returnval[8];
                document.form1.manufacturername.value=returnval[9];
                document.form1.makearea.value=returnval[10];
                document.form1.manufacturebrand.value=returnval[11];
                document.form1.drawingpiececode.value=returnval[12];
                document.form1.isbuy.value=returnval[13];
                document.form1.balancemode.value=returnval[14];
                document.form1.remark.value=returnval[16];
                var prope=returnval[15];
                var reg=";";
                var pro=new Array(6);
                if(prope!=null&&Trim(prope)!=""){
                    reg=prope.substring(prope.length-1,prope.length);
                    var str=prope.split(reg);
                    for (var tI = 0; tI < 6; tI++) {
                        var bl=1;
                        for(var a=0;a<str.length;a++)
                        {
                            var st=str[a].split("：");
                            if(st.length<=1){
                                st=str[a].split(":");
                            }
                            if(st[0]=="适用车型"){
                                document.form1.pro1.value=st[1];
                            }
                            if(st[0]=="适用机型"){
                                document.form1.machinetype.value=st[1];
                            }
                            if(st[0]=="适用底盘"){
                                document.form1.pro3.value=st[1];
                            }
                            if(st[0]=="级别特征"){
                               document.form1.pro4.value=st[1];
                            }
                            if(st[0]=="材质"){
                                document.form1.pro5.value=st[1];
                            }
                            if(st[0]=="其他属性"){
                                document.form1.pro6.value=st[1];
                            }
                        }
                    }
             }
             
            }
        }
        var request = false;
        function selectyes(a,b){
            a.value=Trim(a.value);
            if(Trim(a.value)==""){
                return false;
            }
            if(window.XMLHttpRequest) {  //非IE浏览器，用xmlhttprequest对象创建
                request=new XMLHttpRequest();
            } else if(window.ActiveXObject) { //IE浏览器用activexobject对象创建
                request=new ActiveXObject("Microsoft.XMLHttp");
            }
            
            if(request){
                var sid= Trim(a.value);
                var url = "<%=response.encodeURL(root+"/jsp/sysmaintain/manufactureAddCon.jsp")%>?conid=" + sid+"&ck="+b; 
                url=encodeURI(url);
                request.open("GET", encodeURI(url), true); 
                if(b=="1"){
                    request.onreadystatechange = updatePage; 
                }else if(b=="2"){
                    request.onreadystatechange = updatePage2;
                }
                request.send(null);
            }else{
                document.getElementById("conidyes").innerText="*";
            }
        }
        
        function updatePage(){
        var f=document.getElementById("conidyes");
        var p=document.getElementById("oldpid");
        var sign=document.getElementById("sign");
            if(request.readyState == 4){      //已完成
                if(request.status == 200){ 
                    var text = request.responseText;
                    if(text!=null&&Trim(text)!=""){
                        
                        sign.value="1";
                        var row=Trim(text).split("-");
                        f.innerHTML="<a href='javascript:void(0);' onclick='find();'>有 "+row[0]+" 条相同集中编码产品</a>";
                        if(row.length>1){
                            p.value=row[1];
                        }
                    }else{
                        f.innerText="*";
                        sign.value="0";
                        p.value="";
                    }
                }else 
                    f.innerText="*";
                    sign.value="0";
                }
        }
        function updatePage2(){
            var newproname=document.getElementById("provider_name");
            var newproid=document.getElementById("provider_id");
            if(request.readyState == 4){      //已完成
                if(request.status == 200){ 
                    var text = request.responseText;
                    if(text!=null&&Trim(text)!=""){
                        var t=Trim(text).split("%");
                        newproid.value=t[0];
                        newproname.value=t[1];
                    }else{
                        alert("该供应商不存在，重新输入或选择");
                    }
                }else 
                    f.innerText="*";
                }
        }
        function downmanufacture(){
        var isPlanPrice = <%=isPlanPrice%>;
        if(isPlanPrice==1){
            window.document.location.href="<%=response.encodeURL(root+"/jsp/sysmaintain/manufactureDownPlanPrice.jsp")%>";
            }else{
            window.document.location.href="<%=response.encodeURL(root+"/jsp/sysmaintain/manufactureDown.jsp")%>";
            }
        }
        function viewmanufacture(){
            window.document.location.href="<%=response.encodeURL(request.getContextPath()+"/A400312.do")%>";
        }
    </script>
</body>
</html>